<template>
    <div class="Login">
      <form action=""  @submit.prevent="Login">
        <input type="text" v-model="Login.number" class="loginInput" placeholder="请输入手机号">
        <button type="submit" class="bigBtn">确认</button>
      </form>
        
    </div>
</template>


<script>
import axios from "axios";
import $qs from 'qs'
export default {
  name: 'UserHeader',
  data: {
    Login:{
        number:'',        //电话
      }     
  },
  methods:{
    Login:function(){
        var that = this
        console.log(that)
        var openid = localStorage.getItem("openid")
        let pageList = that.$qs.stringify({
            openid: openid,
            number:that.Login.number
        });
        axios({
            method: "post",
            url: "/index/user/binding",
            headers: {
                "Content-Type": "application/x-www-form-urlencoded"
            },
            data: pageList
        }).then(res => {
            console.log(res.data);
            if( res.data.status == 200){
              this.$router.push({path: '/User'});
            }else{
              alert('网络不好请重试')
            }
            //this.$router.push({path: '/User'});
        });
    }
  },
  mounted(){

  }
}
</script>

<style scoped>
.loginInput{
  width:87%;
  display: inline-block;
  margin-left:3%;
  padding:3% ;
  border:0;
  border-radius: 5px;
  margin-top:30px
}
.bigBtn{
  width:94%;
  margin-left:3%;
  display: inline-block;
  padding:12px ;
  border:0;
  border-radius: 5px;
  background: #FE2746;
  color:#FFF;
  margin-top:50px;
}
</style>
